﻿using System;
using System.Text;
using System.Web;
using Clipping.Infrastructure.Interfaces;

namespace Clipping.SearchUrlConstructors
{
	public class GoogleNewsUrlConstructor : ISearchUrlConstruct
	{
		private Encoding _urlEncoding = Encoding.UTF8;
		public Uri ConstructUrl(Infrastructure.Models.SearchObject searchObj)
		{
			//Contract.Requires(searchObj != null);
            string url = string.Format("https://www.google.com.hk/search?hl=zh-CN&gl=cn&tbm=nws&authuser=0&q={0}", HttpUtility.UrlEncode(searchObj.Keyword, this._urlEncoding));
			return new Uri(url);
		}


		public Uri ConstructAbsoluteUrl(Uri baseUri, string url)
		{
	
			return UriHelper.ConstructAbsoluteUrl(baseUri, url);
		}
	}
}
